using System;
using System.Collections;
using System.Collections.Generic;
using Sustainalytics.Synchronization.Validation.ValidationRules.Common;

namespace Sustainalytics.Synchronization.Validation.Validators
{
    public class ValidationFailure
    {
        public readonly Guid Key;

        public readonly string ValidationError;

        public readonly IEnumerable<string> Triggers;

        public readonly Severity Severity;

        public readonly BusinessResearchProduct ResearchProduct;

        public readonly string Code;

        public readonly string Comment;

        public ValidationFailure(Guid key, string errorMessage, Severity severity, BusinessResearchProduct researchProduct, string code, string comment, IEnumerable<string> triggers)
        {
            this.Key = key;
            this.ValidationError = errorMessage;
            this.Severity = severity;
            this.ResearchProduct = researchProduct;
            this.Code = code;
            this.Comment = comment;
            this.Triggers = triggers;
        }

        public static bool IsNullOrEmpty(ValidationFailure failure)
        {
            return failure.Equals(null) || string.IsNullOrEmpty(failure.ValidationError);
        }
    }
}